package com.gbq.qimo.servlet;

import com.gbq.qimo.service.StudentService;
import com.gbq.qimo.service.impl.StudentServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @ClassName DeleteStudentByIdServlet
 * @Description TODO
 * @Author guobenqi
 * @Date 2021/5/29 23:03
 */
@WebServlet("/deleteStudentById")
public class DeleteStudentByIdServlet extends HttpServlet {
    private StudentService studentService = new StudentServiceImpl();
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        int count = studentService.deleteStudentById(Integer.parseInt(id));
        response.sendRedirect(request.getContextPath()+"/findStudentByPage");
    }
}
